import 'package:flutter/material.dart';

class InputWidget extends StatefulWidget {
  final String hintText;
  final String endText;
  final Color endTextColor;
  final bool isCenter;
  final double width;
  const InputWidget(
      {Key key,
      this.hintText,
      this.endText = '',
      this.endTextColor = Colors.grey,
      this.isCenter = false, this.width})
      : super(key: key);

  @override
  _InputWidgetState createState() => _InputWidgetState();
}

class _InputWidgetState extends State<InputWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: widget.width,
      alignment: Alignment.centerLeft,
      height: 35,
      decoration: BoxDecoration(
        color: Colors.grey[200],
      ),
      child: TextField(
        textAlign: widget.isCenter ? TextAlign.center : TextAlign.start,
        textInputAction: TextInputAction.next,
        cursorColor: Colors.grey,
        decoration: InputDecoration(
            border: InputBorder.none,
            hintText: widget.hintText,
            contentPadding: EdgeInsets.symmetric(horizontal: 10),
            hintStyle: TextStyle(fontSize: 12, color: Colors.grey)),
      ),
    );
  }
}

class InputWidget2 extends StatefulWidget {
  final String hintText;
  final String endText;
  final Color endTextColor;
  final bool isCenter;
  final double width;
  const InputWidget2(
      {Key key,
      this.hintText,
      this.endText = '',
      this.endTextColor = Colors.grey,
      this.isCenter = false, this.width})
      : super(key: key);

  @override
  _InputWidget2State createState() => _InputWidget2State();
}

class _InputWidget2State extends State<InputWidget2> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: widget.width,
      height:  150,
      decoration: BoxDecoration(
        color: Colors.grey[200],
      ),
      child: TextFormField(
        textAlign: widget.isCenter ? TextAlign.center : TextAlign.start,
        textInputAction: TextInputAction.next,
        maxLines: 2,
        decoration: InputDecoration(
            fillColor: Colors.grey,
            border: InputBorder.none,
            hintText: widget.hintText,
            contentPadding: EdgeInsets.symmetric(horizontal: 10),
            hintStyle: TextStyle(fontSize: 12, color: Colors.grey)),
      ),
    );
  }
}
